import pandas as pd
class To_excle(object):
    def __init__(self,filename,final_data_list) -> None:
        self.filename = filename
        self.data = final_data_list
        
    def turn_to_excel(self):
        
        section = []
        company_name = []
        registration_time = []
        url = []
        
        for i in range(len(self.data)):
            section.append(self.data[i]["section"])
            company_name.append(self.data[i]["headline"])
            registration_time.append(self.data[i]["time"])
            url.append(self.data[i]["url"])
 
    
        dfData = {  
            'section': section,
            'company_name': company_name,
            'registration_time': registration_time,
            'url': url,
        }
        df = pd.DataFrame(dfData)  
        df.to_excel(self.filename, index=False) 